home *** CD-ROM | disk | FTP | other *** search
/ MACD 5 / MACD 5.bin / workbench / libs / includelib.lha / include / libraries / cdplay.h
C/C++ Source or Header  |  1996-09-19  |  5KB  |  185 lines

  1.  
  2. #ifndef _CDPLAY_H
  3. #define _CDPLAY_H
  4.  
  5. /*
  6. **  cdplay.h
  7. **
  8. **  © 1995, 96 by Patrick Hess, all rights reserved.
  9. **  $VER: cdplay.h 1.0 (20.09.1996)
  10. **
  11. */
  12.  
  13. #ifndef EXEC_TYPES_H
  14. #include <exec/types.h>
  15. #endif
  16.  
  17. #define CDPLAYNAME        "cdplay.library"
  18. #define CDPLAYVERSION        37L
  19.  
  20. /* macros */
  21.  
  22. #define base2min(val)    ((val)/75/60)
  23. #define base2sec(val)    (((val)/75)%60)
  24.  
  25. #define btst(n,m)    (n & m)
  26. #define bchg(n,m)    (n = (n & m) ? (n & (~m)) : ( n | m))
  27. #define bset(n,m)    (n = n | m)
  28.  
  29. /* special cd request */
  30.  
  31. struct CDRequest
  32. {
  33.     struct    IOStdReq    *cdr_Request;
  34.     struct    MsgPort        *cdr_MsgPort;
  35.     struct    CDCapacity    *cdr_Capacity;
  36.     struct    CDInquiry    *cdr_Inquiry;
  37.     struct    CDPTOC        *cdr_TOC;
  38.     struct    CDTime        *cdr_Time;
  39.     struct    CDVolume    *cdr_Volume;
  40.  
  41.     UBYTE    cdr_ID[20];
  42.     UBYTE    cdr_Active;
  43.     UBYTE    cdr_CurrentTrack;
  44.     ULONG     cdr_CurrentAddress;
  45.  
  46.     /* internal buffers, hands off! */
  47.  
  48.     UBYTE    *cdr_SCSISense;
  49.     UBYTE    *cdr_SCSIData;
  50.     UBYTE    *cdr_TOCBuf;
  51. };
  52.  
  53. /* capacity of the cd */
  54.  
  55. struct CDCapacity
  56. {
  57.     ULONG    cdc_MaxSector;        /* max sector */
  58.     ULONG    cdc_SectorSize;    /* size of a sector */
  59.     ULONG    cdc_Capacity;        /* capacity of the cd */
  60. };
  61.  
  62. /* devicetypes */
  63.  
  64. #define    DEVTYPE_DIRECT_ACCESS        0x00    /* Direct-access device (e.g., magnetic disk) */
  65. #define DEVTYPE_SEQUENTIAL_ACCESS    0x01    /* Sequential-access device (e.g., magnetic tape) */
  66. #define DEVTYPE_PRINTER            0x02    /* Printer device */
  67. #define DEVTYPE_PROCESSOR        0x03    /* Processor device */
  68. #define DEVTYPE_WRITE_ONCE        0x04    /* Write-once device (e.g., some optical disks) */
  69. #define DEVTYPE_CDROM            0x05    /* CD-ROM device */
  70. #define DEVTYPE_SCANNER            0x06    /* Scanner device */
  71. #define DEVTYPE_OPTICAL            0x07    /* Optical memory device (e.g., some optical disks) */
  72. #define DEVTYPE_MEDIUM_CHANGER        0x08    /* Medium Changer device (e.g., jukeboxes) */
  73. #define DEVTYPE_COMMUNICATIONS        0x09    /* Communications device */
  74. #define DEVTYPE_ASC_IT8_1        0x0A    /* Defined by ASC IT8 (Graphic Arts Pre-Press Devices) */
  75. #define DEVTYPE_ASC_IT8_2        0x0B    /* Defined by ASC IT8 (Graphic Arts Pre-Press Devices) */
  76. #define DEVTYPE_UNKNOWN              -1    /* Reserved, unknown or no device type */
  77.  
  78. /* ansiversion */
  79.  
  80. #define ANSI_NONE            0x00
  81. #define ANSI_SCSI_1            0x01
  82. #define ANSI_SCSI_2            0x02
  83.  
  84. /* response format */
  85.  
  86. #define RESP_SCSI_1            0x00
  87. #define RESP_CCS            0x01
  88. #define RESP_SCSI_2            0x02
  89.  
  90. /* inquiry flags */
  91.  
  92. #define IFLAG_REMOVABLE            (1 << 0)
  93. #define IFLAG_AENC            (1 << 1)
  94. #define IFLAG_REL_ADDRESS        (1 << 2)
  95. #define IFLAG_16WIDE_DATA        (1 << 3)
  96. #define IFLAG_32WIDE_DATA        (1 << 4)
  97. #define IFLAG_SYNC            (1 << 5)
  98. #define IFLAG_LINKED            (1 << 6)
  99. #define IFLAG_CMDQUE            (1 << 7)
  100. #define IFLAG_SOFTRESET            (1 << 8)
  101. #define IFLAG_TRMIOP            (1 << 9)
  102.  
  103. /* inquiry */
  104.  
  105. struct CDInquiry
  106. {
  107.     ULONG    cdi_Flags;
  108.     UBYTE    cdi_DeviceType;
  109.     UBYTE    cdi_ANSIVersion;
  110.     UBYTE    cdi_ResponseFormat;
  111.     UBYTE    cdi_ISOVersion;
  112.     UBYTE    cdi_ECMAVersion;
  113.     UBYTE    cdi_VendorID[9];
  114.     UBYTE    cdi_ProductID[17];
  115.     UBYTE    cdi_RevisionLevel[5];
  116.     UBYTE    cdi_VendorSpecific[21];
  117.     UBYTE    cdi_Reserved[36];
  118. };
  119.  
  120. /* toc: sub-channel Q */
  121.  
  122. #define TOC_SUBCHAN_NOT_AVAIL                0x00    /* Sub-channel Q mode information not supplied. */
  123. #define TOC_SUBCHAN_CURRENT_POS                0x01    /* Sub-channel Q encodes current position data. */
  124. #define TOC_SUBCHAN_MEDIA_CATALOG_NUM            0x02    /* Sub-channel Q encodes media catalog number. */
  125. #define TOC_SUBCHAN_ISRC                0x03    /* Sub-channel Q encodes ISRC. */
  126. #define TOC_SUBCHAN_RESERVED                  -1    /* Reserved */
  127.  
  128. /* toc: track flags */
  129.  
  130. #define IFLAG_PRE_EMPHASIS                (1 << 0)
  131. #define IFLAG_COPY_PROHIBITED                (1 << 1)
  132. #define IFLAG_AUDIO_TRACK                (1 << 2)
  133. #define IFLAG_2_CHAN                    (1 << 3)
  134.  
  135. /* toc: simple track */
  136.  
  137. struct CDTrack
  138. {
  139.     ULONG    tr_Position;
  140.     ULONG    tr_Flags;
  141.     UBYTE    tr_SubChan;
  142. };
  143.  
  144. /* table of contents */
  145.  
  146. struct CDPTOC
  147. {
  148.     ULONG    cdptoc_TOCSize;
  149.     UBYTE    cdptoc_FirstTrack;
  150.     UBYTE    cdptoc_LastTrack;
  151.  
  152.     struct    CDTrack cdptoc_Track[100];
  153. };
  154.  
  155. /* time of the current track, values must be converted with base2min() and  */
  156. /* base2sec() macros */
  157.  
  158. struct CDTime
  159. {
  160.     ULONG    cdt_TrackCurBase;    /* address: current position (Track) */
  161.     ULONG    cdt_TrackRemainBase;    /* address: remaining time (Track) */
  162.     ULONG    cdt_TrackCompleteBase;    /* address: complete time (Track) */
  163.     ULONG    cdt_AllCurBase;        /* address: current position (CD) */
  164.     ULONG    cdt_AllRemainBase;    /* address: remaining time (CD) */
  165.     ULONG    cdt_AllCompleteBase;    /* address: complete time (CD) */
  166. };
  167.  
  168. /* volume */
  169.  
  170. struct CDVolume
  171. {
  172.     UBYTE cdv_Output[4];
  173.     UBYTE cdv_Volume[4];
  174. };
  175.  
  176. /* results of CDActive() */
  177.  
  178. #define SCSI_STAT_NO_DISK               0       /* no cd in the drive */
  179. #define SCSI_STAT_PLAYING               1       /* audio playing */
  180. #define SCSI_STAT_STOPPED               2       /* drive motor stopped */
  181. #define SCSI_STAT_PAUSED                3       /* audio paused */
  182.  
  183. #endif    /* _CDPLAY_H */
  184.  
  185.